perfflag?=1
testset?=1
matsize?=100

##all: test_mm test_mm_tile
##
##test_mm: test_mm.c gen_matrix.c my_malloc.c gen_matrix.h my_malloc.h
##	mpicc -O3 -xhost -opt-prefetch -ipo -axSSE4.2 test_mm.c gen_matrix.c my_malloc.c time.c -o test_mm
##
##test_mm_tile: test_mm_tile.c gen_matrix.c my_malloc.c gen_matrix.h my_malloc.h
##	mpicc -O3 -xhost test_mm.c gen_matrix.c my_malloc.c time.c -o test_mm_tile
##
##test_mm_serial: test_mm_serial.c gen_matrix.c my_malloc.c gen_matrix.h my_malloc.h
##	gcc -O3 -opt-prefetch test_mm_serial.c gen_matrix.c my_malloc.c time.c -o test_mm_serial



test_cilk: test_mm_cilk test_mm_cilk_tile

test_mm_cilk: test_mm.cilk gen_matrix.c my_malloc.c gen_matrix.h my_malloc.h
	cilkc -cilk-profile -o test_mm_cilk -O3 test_mm.cilk gen_matrix.c my_malloc.c time.c

test_mm_cilk_tile: test_mm_tile.cilk gen_matrix.c my_malloc.c gen_matrix.h my_malloc.h
	cilkc -cilk-profile -o test_mm_cilk_tile -O3 test_mm_tile.cilk gen_matrix.c my_malloc.c time.c



##run:
##	mpirun -np 2 ./test_mm 0 0 4
##
run_cilk: run_cilk_naive run_cilk_tile

run_cilk_naive:
	./test_mm_cilk --stats 1 --nproc 8 $(perfflag) $(testset) $(matsize)

run_cilk_tile:
	./test_mm_cilk_tile --stats 1 --nproc 8 $(perfflag) $(testset) $(matsize)

##run_debug:
##	./test_mm $(perfflag) $(testset) $(matsize) 
##
##run_perf:
##	./test_mm $(perfflag) $(testset) $(matsize) 
##
clean:
	rm -f *.o test_mm_tile test_mm_cilk test_mm_cilk_tile
